package cn.pwrd.custom.util;

import android.content.Context;

public class ErrorCode {

    //网络异常
    public static final int ERROR_NET = -4;
    //未知错误
    public static final int ERROR_UNKOW = -3;
    //请求成功
    public static final int OK = 0;
    //用户名已被注册
    public static final int ERROR_USERNAME_REPETITION = 2002;
    //用户名不合法
    public static final int ERROR_USERNAME_NOT_VALID = 2003;
    //验证码错误
    public static final int ERROR_VERIFICATION_CODE_NOT_VALID = 2004;
    //用户名包含非法字符
    public static final int ERROR_USERNAME_FORBIDDEN_CHAR = 2013;
    //未登陆
    public static final int ERROR_NEED_LOGIN = 3000;

    public static String getErrorTips(Context context, int errorCode, String defaultTips){
        String tips;
        switch (errorCode){
            case ERROR_NET:
                tips = context.getString(R.string.net_error_retry_tips);
                break;
            case ERROR_NEED_LOGIN:
                tips = context.getString(R.string.reLogin_retry_tips);
                break;
            default:
                tips = defaultTips;
                break;
        }

        return tips;
    }
}
